package com.ruoyi.project.statistics.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.statistics.domain.Drug;
import com.ruoyi.project.statistics.service.IDrugService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/statistics/drug")
public class DrugController extends BaseController {

    @Autowired
    private IDrugService idrugService;

    /**
     * 查询发药统计列表
     */
    @PostMapping("/list")
    public TableDataInfo list(Drug drug){
        startPage();
        List<Drug> list = idrugService.selectByTime(drug);
        return getDataTable(list);
    }


    /**
     * 查询发药数量统计列表
     */
    @GetMapping("/list2")
    public TableDataInfo list2(Drug drug){
        startPage();
        List<Drug> list = idrugService.selectByTime2(drug);
        return getDataTable(list);
    }

    @GetMapping("/list3")
    public TableDataInfo list3(String drugName, Date createTime){
        startPage();
        List<Drug> list=idrugService.selectDrug(drugName, createTime);
        return getDataTable(list);
    }

}
